#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    void moveZeroes(vector<int>& nums) {
        int pre = 0;
        int cur = 0;
        while (cur < nums.size())
        {
            if (nums[cur] != 0 && nums[pre] == 0)
            {
                swap(nums[cur], nums[pre]);
                cur++;
                pre++;
            }
            else if (nums[cur] == 0 && nums[pre] == 0)
            {
                cur++;
            }
            else
            {
                cur++;
                pre++;
            }
        }


    }
};